package com.wn.feign.api;

import com.wn.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author yellow Docter
 * @date 2023 -07-18
 * @desc
 *
 * path = "/user" 方法的映射的前缀
 *
 */
@FeignClient(value = "user-service",path = "/user")
public interface UserFeignApi {

    @GetMapping("/list")
    public List<User> findUsers();

    @GetMapping("/page/{currentPage}/{pageSize}")
    public Map pageUsers(@PathVariable("currentPage") Integer currentPage, @PathVariable("pageSize") Integer pageSize);


    @PostMapping
    public String addUser(@RequestBody User user);
    @PutMapping("")
    public String updateUsers(@RequestBody User user);

    @DeleteMapping("/{id}")
    public String findUsers(@PathVariable("id") Integer id) ;

    @GetMapping("/{id}")
    public User getUserById(@PathVariable("id") Integer id);

}
